package com.zhongyouyun.lbyc.service.imp;

import com.zhongyouyun.admin.model.UserModel;
import com.zhongyouyun.admin.service.UserService;
import com.zhongyouyun.cqyc.model.NoticeTypeModel;
import com.zhongyouyun.lbyc.model.CustomModernEvaluateModel;
import com.zhongyouyun.lbyc.mapper.CustomModernEvaluateMapper;
import com.zhongyouyun.lbyc.pojo.CustomBasePojo;
import com.zhongyouyun.lbyc.pojo.CustomModernEvaluatePojo;
import com.zhongyouyun.lbyc.service.CustomModernEvaluateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.util.List;
import java.util.Map;

/**
 * @Author: shenyi
 * @Date: 2023-11-14
 * @Description: 服务实现类
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class CustomModernEvaluateServiceImpl extends ServiceImpl<CustomModernEvaluateMapper, CustomModernEvaluateModel> implements CustomModernEvaluateService {
    @Autowired
    private UserService userService;

    /*
     * @Author: shenyi
     * @Date: 2021-09-08
     * @Description: 分页查询
     * @param page 分页数据  lambdaQueryWrapper where 条件 和排序
     */
    @Override
    public IPage<CustomModernEvaluateModel> selectPage(Page<CustomModernEvaluateModel> page, QueryWrapper<CustomModernEvaluateModel> queryWrapper) {
        return this.baseMapper.selectPage(page, queryWrapper);
    }


    /*
     * @Author: shenyi
     * @Date: 2021-09-08
     * @Description: 查询全部
     * @param   lambdaQueryWrapper where 条件 和排序
     */
    @Override
    public List<CustomModernEvaluateModel> selectList(QueryWrapper<CustomModernEvaluateModel> queryWrapper) {
        return this.baseMapper.selectList(queryWrapper);
    }

    @Override
    public IPage<CustomModernEvaluatePojo> selectPojoPage(Page page, QueryWrapper<CustomModernEvaluatePojo> queryWrapper) {
        return this.baseMapper.selectPojoPage(page, queryWrapper);
    }

    @Override
    public List<Map<String, Object>> selectjihuan() {
        UserModel userModel = (UserModel) SecurityUtils.getSubject().getPrincipal(); // 获取当前登录用户
        List<Map<String, Object>> list = this.baseMapper.selectjihuan(userModel.getUserName());
        return list;
    }
}
